﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Units.aspx.cs" Inherits="TeamPrasioliteWarGame.Units" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>Recruit Units</legend>
        <asp:ListView ID="ListViewRecruitUnits" runat="server" ItemType="TeamPrasioliteWarGame.Models.GameUnit">
            <LayoutTemplate>
                <div class="barracks" style="width:200px; height:200px"></div>
                <table class="table-striped table-hover table table-bordered table-contents">
                    <thead>
                        <tr>
                            <th>Type</th>
                            <th>Attack</th>
                            <th>Defense</th>
                            <th>Health Points</th>
                            <th>Food cost</th>
                            <th>Iron Cost</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                    </tbody>
                </table>
            </LayoutTemplate>
            <ItemSeparatorTemplate>
                <tr></tr>
            </ItemSeparatorTemplate>
            <ItemTemplate>
                <td class="<%#: Item.Type %>"><%#: Item.Type %></td>
                <td class="attack"><%#: Item.Attack %></td>
                <td class="defense"><%#: Item.Defense %></td>
                <td class="hp"><%#: Item.HP %></td>
                <td class="food"><%#: Item.FoodCost %></td>
                <td class="iron"><%#: Item.IronCost %></td>
                <td>
                    <asp:HyperLink Text="Recruit" CssClass="btn btn-success"
                                   NavigateUrl='<%#: "Recruite.aspx?unitType=" + Item.Id %>' runat="server"
                                   ></asp:HyperLink>
                </td>
            </ItemTemplate>
            <EmptyDataTemplate>
                <tr>
                    <td colspan="8">You must build barracks first!</td>
                </tr>
            </EmptyDataTemplate>
        </asp:ListView>
    </fieldset>

    <br />
    <fieldset>
        <legend>Your units</legend>
        <asp:ListView ID="ListViewUnits" runat="server" ItemType="TeamPrasioliteWarGame.Models.UserUnit">
            <LayoutTemplate>
                <table class="table-striped table-hover table table-bordered table-contents">
                    <thead>
                        <tr>
                            <th>Type</th>
                            <th>Attack</th>
                            <th>Defense</th>
                            <th>Health Points</th>
                            <th>Count</th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                    </tbody>
                </table>
            </LayoutTemplate>
            <ItemSeparatorTemplate>
                <tr></tr>
            </ItemSeparatorTemplate>
            <ItemTemplate>
                <td class="<%#: Item.GameUnit.Type %>"><%#: Item.GameUnit.Type %></td>
                <td class="attack"><%#: Item.GameUnit.Attack %></td>
                <td class="defense"><%#: Item.GameUnit.Defense %></td>
                <td class="hp"><%#: Item.GameUnit.HP %></td>
                <td><%#: Item.Count %></td>
            </ItemTemplate>
            <EmptyDataTemplate>
                <tr>
                    <td colspan="5">You dont have any units yet!</td>
                </tr>
            </EmptyDataTemplate>
        </asp:ListView>
    </fieldset>
</asp:Content>